using System.Text;
using GetTogether.RichText.Support;

namespace GetTogether.RichText.Interpreter
{

	
	public sealed class RtfTextBuilder : RtfElementVisitorBase
	{

		
		public RtfTextBuilder() :
			base( RtfElementVisitorOrder.DepthFirst )
		{
			Reset();
		} // RtfTextBuilder

		
		public string CombinedText
		{
			get { return buffer.ToString(); }
		} // CombinedText

		
		public void Reset()
		{
			buffer.Remove( 0, buffer.Length );
		} // Reset

		
		protected override void DoVisitText( IRtfText text )
		{
			buffer.Append( text.Text );
		} // DoVisitText

		
		// members
		private readonly StringBuilder buffer = new StringBuilder();

	} // class RtfTextBuilder

} 

